import u from "../utils";
import { EXCEL } from "../constants";

const _api = u.api(EXCEL);

export default {
    saveFormAndField: data => _api('saveFormAndField', { type: 'post', data }),
    getExcelPages: appid => _api('getExcelPages', { data: { appid } }),
    pageInfo: id => _api('getExcelPageInfo', { data: { id } }),
    uploadData: data => _api('uploadData', { data, type: 'post' }),
    saveData: data => _api('saveData', { data, type: 'post' }),
    deleteData: data => _api('deleteData', { data, type: 'post' }),
    deleteViewData: data => _api('deleteViewData', { data, type: 'post' }),
    getProgress:pgid => _api('getProgress',{data:{pgid}}),
    finishProgress:pgid => _api('finishProgress',{data:{pgid}, type:'post'})
}

export const savePage = ({ id, name }) => _api(`page/${id}`, { data: { name }, type: 'post' });
export const setDefaultShow = ({ id, appid, defaultshow }) => _api(`setDefaultShow/${id}`, { data: { appid, defaultshow }, type: 'post' });
export const deletePage = (id) => _api(`deletePage/${id}`, { type: 'post' });